# Importing Data
FRANCE<- read_excel("C:/users/Biniam/Desktop/Documents/Academic/Thesis/Analysis Folder/Excel Files/Aluminium/Aluminium.xlsx",sheet = "Sheet1", range = "L1:L229")

# Checking the Imported Data
View(FRANCE)
# Creating Time Series Data
FRANCE_ts <- ts(FRANCE, start=c(1998,1), end=c(2016,12), frequency=12)
# Viewing and Checking the Created Time Series Data
FRANCE_ts
sum(is.na(FRANCE_ts))
library(forecast)
FRANCE_ts <- tsclean(FRANCE_ts)
FRANCE_ts

# Identification: Plotting the Time Series Data
plot(FRANCE_ts)

# Estimating the appropriate model
FRANCE_ts_model <- auto.arima(FRANCE_ts)
FRANCE_ts_model

# Forecasting
options(max.print=1000000)
FRANCE_ts_forecast <- forecast (FRANCE_ts_model, level=c(95), h=288)
plot(FRANCE_ts_forecast)
FRANCE_ts_forecast             

# Exporting
write.table(FRANCE_ts_forecast, file="/users/Biniam/Desktop/Documents/Academic/Thesis/Result Folder/TSA Results/Excel Files/From R/Aluminium/FRANCE_TSA.csv", sep=",")
